<template>
  <div class="left">
    <b
      v-for="(v, i) in data"
      :key="i"
      :class="activeIndex === i ? 'active' : ''"
      @click="handleClick(i)"
      >{{ v.name }}</b
    >
  </div>
</template>
      // @click="$emit('changeActiveIndex', i)"


<script>
export default {
  props: ['data', 'activeIndex'],
  methods: {
    handleClick(i) {
      this.$emit('changeActiveIndex', i)
    }
  }
};
</script>

<style>
.left {
  width: 80px;
  height: 100%;
  overflow-y: scroll;
  background: skyblue;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.left b {
  padding: 6px 12px;
  color: #fff;
}

.left b.active {
  color: red;
}

</style>